home *** CD-ROM | disk | FTP | other *** search
- Path: erich.triumf.ca!bennett
- From: bennett@erich.triumf.ca (P.Bennett)
- Newsgroups: comp.lang.c
- Subject: Re: Problem with stringcopy
- Date: 6 Jan 1996 09:05 PST
- Organization: TRIUMF: Tri-University Meson Facility
- Distribution: world
- Message-ID: <6JAN199609050601@erich.triumf.ca>
- References: <4clguu$9fs@eagle.novo.dk>
- NNTP-Posting-Host: ftp.triumf.ca
- News-Software: VAX/VMS VNEWS 1.50
-
- In article <4clguu$9fs@eagle.novo.dk>, morb@novo.dk (Morten Brun) writes...
- >How do i do a partial stringcopy i.e. copy from a specific position in
- >a string and a certain numbers of bytes. I am looking for a function
- >like target = Stringcopy(source, startpos, length)
- >Can anybody help please.
-
- Try strncpy(dest, source, size)
-
- If you want to copy 5 chars starting at the 10th char, do something like:
- strcpy(dest, source+10, 5);
-
- There are several string functions starting with "strn" that deal with a
- specified number of chars, rather than with the whole string.
-
-
- Peter Bennett VE7CEI | Vessels shall be deemed to be in sight
- Internet: bennett@triumf.ca | of one another only when one can be
- Packet: ve7cei@ve7kit.#vanc.bc.ca | observed visually from the other
- TRIUMF, Vancouver, B.C., Canada | ColRegs 3(k)
- GPS and NMEA info and programs: ftp://sundae.triumf.ca/pub/peter/index.html
-
-